const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    shopItemId: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "主键",
      field: "shop_item_id"
    },
    shopId: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "店铺编号",
      field: "shop_id"
    },
    itemId: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "商品编号",
      field: "item_id"
    },
    shopItemName: {
      type: DataTypes.STRING(255),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "店铺商品名称",
      field: "shop_item_name"
    },
    shopSpuId: {
      type: DataTypes.STRING(100),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "店铺SPU编码;店铺款式编码",
      field: "shop_spu_id"
    },
    shopSkuId: {
      type: DataTypes.STRING(100),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "店铺SKU编码",
      field: "shop_sku_id"
    },
    shopPrice: {
      type: DataTypes.DECIMAL,
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "平台价格;填写平台积分时仅做参考（积分换算的金额）",
      field: "shop_price"
    },
    shopPoint: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "平台积分",
      field: "shop_point"
    },
    shopQty: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "店铺库存",
      field: "shop_qty"
    },
    pic: {
      type: DataTypes.STRING(255),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "图片地址",
      field: "pic"
    },
    enabled: {
      type: DataTypes.INTEGER(1),
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "是否上架",
      field: "enabled"
    },
    createdTime: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "创建时间",
      field: "created_time"
    },
    modifiedTime: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "修改时间",
      field: "modified_time"
    }
  };
  const options = {
    tableName: "shop_item",
    comment: "",
    indexes: [{
      name: "unique_shop_sku_id",
      unique: false,
      type: "BTREE",
      fields: ["shop_sku_id"]
    }]
  };
  const ShopItemModel = sequelize.define("shopItemModel", attributes, options);
  return ShopItemModel;
};